#!/bin/bash
set -o errexit

options=()
while [[ "$1" = -* ]]
do
  options+=( "$1" )
  shift
done

if [ $# -lt 1 ]
then
  echo "usage: $0 [--debug] [--release] CONFIG.toml [VECTOR-OPTIONS]"
  exit 1
fi

config="$1"
shift

scripts="$(dirname $0)"
features=$( "$scripts"/features "$config" )

exec cargo run "${options[@]}" --no-default-features --features "$features" -- --config "$config" "$@"
